#include "ZDpi.h"

#define TEST_DPI 96

namespace ZuiLib
{

ZDpi::ZDpi()
{
	float dpi = 96.0;
	SDL_GetDisplayDPI(0, &dpi, NULL, NULL);
#ifdef TEST_DPI
	m_dpi = TEST_DPI;
#else
	m_dpi = (int)dpi;
#endif
	LOG(LS_INFO) << "GetDPI " << m_dpi;
}


ZDpi::~ZDpi()
{

}

int ZDpi::GetDpi()
{
	return m_dpi;
}

RECT ZDpi::Scale(const RECT& rc)
{
	RECT rc2 = { Scale(rc.left), Scale(rc.top), Scale(rc.right), Scale(rc.bottom) };
	return rc2;
}

SIZE ZDpi::Scale(const SIZE& size)
{
	SIZE sz2 = {Scale(size.cx),Scale(size.cy)};
	return sz2;
}

POINT ZDpi::Scale(const POINT& pt)
{
	POINT pt2 = { Scale(pt.x), Scale(pt.y) };
	return pt2;
}


RECT ZDpi::UnScale(const RECT& rc)
{
	RECT rc2 = { UnScale(rc.left), UnScale(rc.top), UnScale(rc.right), UnScale(rc.bottom) };
	return rc2;
}

SIZE ZDpi::UnScale(const SIZE& size)
{
	SIZE sz2 = { UnScale(size.cx), UnScale(size.cy) };
	return sz2;
}

POINT ZDpi::UnScale(const POINT& pt)
{
	POINT pt2 = { UnScale(pt.x), UnScale(pt.y) };
	return pt2;
}

bool ZDpi::UseImageScale()
{
	return true;
}

}